<?php

	/**
	* Edit Logo at the top
	* for project CMS Koray
	* @author trungdt
	* @since June 3
	* @copyright Absoft Viet Nam
	*/
	if (!defined('EXPONENT')) exit('');

	if (exponent_users_isAdmin() && isset($_REQUEST['content']) && isset($_REQUEST['file_id']))
	{
        $LANG = LANG;
        $sql_where = "lang_name='{$LANG}'";
		$contact=null;
        $contact->content = $_REQUEST['content'];
		$contact->footer = $_REQUEST['footer'];
        $contact->file_id = intval($_REQUEST['file_id']);
		$contact->scale_font = intval($_REQUEST['font_scale']);
		$db->updateObject($contact,"sitelogo","{$sql_where}");
		// save into the session
		$logo_path = $db->selectObject("file","id = ".intval($contact->file_id));
		$logo_path = URL_FULL.$logo_path->directory.$logo_path->filename;
		$contact->file_path = $logo_path;
		exponent_sessions_set("ab_sitelogo_".LANG,$contact);
		
	} else {
		echo SITE_403_HTML;
	}

	exponent_flow_redirect();
?>